package com.st.controller;

import com.st.entity.*;
import com.st.service.IScenicDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/scenicDetail")
public class ScenicDetailController {
    @Autowired
    private IScenicDetailService iScenicDetailService;
    //搜索+分页
    @RequestMapping("/scenicDetailSearch")
    public PageResult<ScenicDetail> search(@RequestBody PageDTO<ScenicDetail> pageDTO){
        PageResult<ScenicDetail> search = iScenicDetailService.search(pageDTO);
        return search;
    }
    //查找所有景区
    @RequestMapping("/scenicSearch")
    public Result scenicSearch(){
        return iScenicDetailService.scenicSearch();
    }
    //添加景区详情或编辑
    @RequestMapping("/addScenicDetail")
    public Result addScenicDetail(@RequestBody ScenicDetail scenicDetail){
        return  iScenicDetailService.addScenicDetail(scenicDetail);
    }
    @RequestMapping("/edit")
    public Result edit(@RequestBody ScenicDetail scenicDetail){
        return iScenicDetailService.edit(scenicDetail);
    }
    //删除
    @RequestMapping("/del")
    public Result del(@RequestBody ScenicDetail scenicDetail){
        return iScenicDetailService.del(scenicDetail);
    }
    //批量删除
    @RequestMapping("/delAll")
    public Result delAll(@RequestBody List<Integer> ids){
        return iScenicDetailService.delAll(ids);
    }
}
